import request from "@/api/http";

// export function wxLogin_api(data) {
// 	return request.post('/Common/wxLogin', data, {
// 		login: false,
// 		loading: false,
// 		loading_title: '',
// 	});
// }

//微信登录
export function wxLogin_api(code) {
  return request.get(
    "/wechat/login",
    { code },
    {
      login: false,
      loading: false,
      loading_title: "",
    }
  );
}
// 获取天气信息
export function getWeather_api(data) {
  return request.get("/showData/weather", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//获取轮播图
export function getBanner_api(data) {
  return request.get("/showData/banner", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取科普文章
export function getArticle_api(data) {
  return request.post("/wx-article/page", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取文章标签
export function getArticleTag_api(data) {
  return request.get("/wx-article/tags", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取文章详情
export function getArticleDetail_api(data) {
  return request.get("/wx-article/detail", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 记录用户阅读历史
export function recordReadHistory_api(data) {
  return request.post("/wx-article/read-history", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//点赞
export function like_api(data) {
  return request.get("/wx-article/like", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//收藏
export function collect_api(data) {
  return request.get("/wx-article/collect", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//评论
export function comment_api(data) {
  return request.post("/wx-article/comment", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 我的收藏
export function getMyCollect_api(data) {
  return request.get("/mine/collect", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 我的 - 数据统计
export function getMyData_api(data) {
  return request.get("/mine/statistics", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 浏览历史
export function getMyHistory_api(data) {
  return request.get("/mine/viewHistory", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//清空浏览历史
export function clearMyHistory_api(data) {
  return request.get("/mine/clearViewHistory", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}
//历史聊天记录
export function getMyChatHistory_api(data) {
  return request.get("/ai/history", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//保存聊天记录
export function saveChatHistory_api(data) {
  return request.post("/ai/saveHistory", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//新增聊天记录
export function addChatHistory_api(data) {
  return request.post("/ai/addHistory", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 删除聊天记录
export function deleteChatHistory_api(data) {
  return request.get("/ai/delHistory", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取推荐文章
export function getRecommendArticle_api(data) {
  return request.get("/showData/recommend", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//识别药材信息
export function identifyHerb_api(data) {
  return request.get("/recognize/result", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//保存识别记录
export function saveIdentifyHerb_api(data) {
  return request.post("/recognize/save", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//查看识别记录
export function getIdentifyHerb_api(data) {
  return request.get("/recognize/record", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 删除单个识别记录
export function deleteIdentifyHerb_api(data) {
  return request.get("/recognize/delete", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//批量删除识别记录
export function deleteAllIdentifyHerb_api(data) {
  return request.get("/recognize/deleteBatch", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

/** 电商部分 */

// 获取热销前5个商品
export function getHotProduct_api(data) {
  return request.get("/online-retailers/hot", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取商品列表
export function getProductList_api(data) {
  return request.post("/online-retailers/list", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取商品详情
export function getProductDetail_api(data) {
  return request.get(
    "/online-retailers/goods-info/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}

//创建订单
export function createOrder_api(data) {
  return request.post("/online-retailers/create", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}
// 支付
export function pay_api(data) {
  return request.get(
    "/online-retailers/pay/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}
// 获取订单列表
export function getOrderList_api(data) {
  return request.post("/online-retailers/order-page", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}
//申请售后
export function applyAfterSale_api(data) {
  return request.post("/online-retailers/createAfterSales", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//获取售后详情
export function getAfterSaleDetail_api(data) {
  return request.get(
    "/online-retailers/after-sales/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}

// 取消订单
export function cancelOrder_api(data) {
  return request.get(
    "/online-retailers/cancel/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}

//确认收货
export function confirmOrder_api(data) {
  return request.get(
    "/online-retailers/confirm/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}

//提醒发货
export function remindOrder_api(data) {
  return request.get(
    "/online-retailers/remind/" + data.id,
    {},
    {
      login: true,
      loading: false,
      loading_title: "",
    }
  );
}
// 推荐菜品
export function recommendFood_api(data) {
  return request.get("/recognize/dishes", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

//个人信息修改
export function updateUserInfo_api(data) {
  return request.post("/mine/setInfo", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}

// 获取用户信息
export function getUserInfo_api(data) {
  return request.get("/mine/getInfo", data, {
    login: true,
    loading: false,
    loading_title: "",
  });
}
